home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.xml;
-
- import com.extensibility.pub.SchemaError;
- import com.extensibility.util.Debug;
- import java.text.Format;
- import java.text.MessageFormat;
- import java.util.Enumeration;
- import java.util.MissingResourceException;
- import java.util.ResourceBundle;
- import java.util.Stack;
- import java.util.Vector;
-
- public class ParserException extends Exception implements SchemaError {
- public static final int NOTE = 0;
- public static final int WARNING = 1;
- public static final int SEVERE = 2;
- static ResourceBundle res;
- boolean reported;
- Exception original;
- int syntaxLoc;
- String message;
- String offender;
- int sourcePos;
- int sourceLinePos;
- String source;
- URI sysURI;
- int severity;
- Stack stack;
- ParserException[] collection;
- ParserException mostSevere;
-
- public static void setMessageBundle(ResourceBundle var0) {
- res = var0;
- }
-
- public ParserException(int var1, String var2, int var3) {
- this(var1, var2);
- this.severity = var3;
- }
-
- public ParserException(int var1, String var2) {
- this.severity = 2;
- this.syntaxLoc = var1;
- this.offender = var2;
- }
-
- public ParserException(int var1, char var2, int var3) {
- this(var1, var2);
- this.severity = var3;
- }
-
- public ParserException(int var1, char var2) {
- this.severity = 2;
- this.syntaxLoc = var1;
- this.offender = (new Character(var2)).toString();
- }
-
- public ParserException(Exception var1, String var2) {
- this.severity = 2;
- this.original = var1;
- this.offender = var2;
- }
-
- public ParserException(String var1, String var2, int var3, int var4) {
- this.severity = 2;
- this.message = var1;
- this.setContext(var2, var3, var4);
- }
-
- public ParserException(Vector var1) {
- this.severity = 2;
- Debug.assert(var1 != null && var1.size() > 0, "can't wrap no exceptions!");
- int var2 = -1;
- int var3 = -1;
- this.collection = new ParserException[var1.size()];
-
- for(int var4 = 0; var4 < var1.size(); ++var4) {
- this.collection[var4] = (ParserException)var1.elementAt(var4);
- if (this.collection[var4].getSeverity() > var2) {
- var3 = var4;
- var2 = this.collection[var4].getSeverity();
- }
- }
-
- this.mostSevere = this.collection[var3];
- }
-
- public int getSyntaxLoc() {
- return this.mostSevere != null ? this.mostSevere.getSyntaxLoc() : this.syntaxLoc;
- }
-
- public String getOffender() {
- return this.mostSevere != null ? this.mostSevere.getOffender() : this.offender;
- }
-
- public Exception getOriginal() {
- return this.mostSevere != null ? this.mostSevere.getOriginal() : this.original;
- }
-
- public boolean hasBeenReported() {
- return this.reported;
- }
-
- public void setBeenReported(boolean var1) {
- this.reported = var1;
- }
-
- public int getSeverity() {
- return this.mostSevere != null ? this.mostSevere.getSeverity() : this.severity;
- }
-
- public void setSeverity(int var1) {
- this.severity = var1;
- }
-
- public String getMessage() {
- if (this.message != null) {
- return this.message;
- } else {
- String var1 = System.getProperty("line.separator");
- if (this.mostSevere != null) {
- StringBuffer var8 = new StringBuffer(this.mostSevere.getMessage());
-
- for(int var10 = 0; var10 < this.collection.length; ++var10) {
- if (this.collection[var10] != this.mostSevere) {
- var8.append(String.valueOf(this.collection[var10]).concat(String.valueOf(var1)));
- }
- }
-
- return var8.toString();
- } else {
- String var3 = null;
-
- String var2;
- try {
- if (this.original != null) {
- var3 = this.original.getClass().getName();
- } else {
- var3 = (new Integer(this.syntaxLoc)).toString();
- }
-
- if (res == null) {
- throw new MissingResourceException("", "", "");
- }
-
- var2 = res.getString(var3);
- } catch (MissingResourceException var6) {
- return var3;
- }
-
- MessageFormat var4 = new MessageFormat(var2);
- String[] var5 = new String[]{this.offender != null ? this.offender : ""};
- var2 = ((Format)var4).format(var5);
- return var2;
- }
- }
- }
-
- public int getSourcePos() {
- return this.mostSevere != null ? this.mostSevere.getSourcePos() : this.sourcePos;
- }
-
- public int getSourceLinePos() {
- return this.sourceLinePos;
- }
-
- public String getSource() {
- return this.mostSevere != null ? this.mostSevere.getSource() : this.source;
- }
-
- public URI getURI() {
- return this.mostSevere != null ? this.mostSevere.getURI() : this.sysURI;
- }
-
- public void setSyntaxLoc(int var1) {
- this.syntaxLoc = var1;
- }
-
- public void setOffender(String var1) {
- this.offender = var1;
- }
-
- public void setOriginal(Exception var1) {
- this.original = var1;
- }
-
- public void setSourceLinePos(int var1) {
- this.sourceLinePos = var1;
- }
-
- public void setSourcePos(int var1) {
- this.sourcePos = var1;
- }
-
- public void setSource(String var1) {
- this.source = var1;
- }
-
- public void setURI(URI var1) {
- this.sysURI = var1;
- }
-
- public void setContext(String var1, int var2, int var3) {
- this.stack = new Stack();
- this.stack.push(new 1(var2, var3, var1, (ParserException)null));
- }
-
- public void setContext(ReaderContext var1, Stack var2) {
- this.setURI(var1.getURI());
- this.stack = new Stack();
-
- for(int var3 = 0; var3 < ((Vector)var2).size(); ++var3) {
- ReaderContext var4 = (ReaderContext)((Vector)var2).elementAt(var3);
- this.stack.push(var4.clone());
- }
-
- this.stack.push(var1.clone());
- }
-
- public Enumeration getContext() {
- return this.stack == null ? (new Vector()).elements() : this.stack.elements();
- }
-
- public ParserException adoptContext(ParserException var1) {
- this.stack = var1.stack;
- this.sourceLinePos = var1.sourceLinePos;
- return this;
- }
- }
-